In modern computing systems, concurrent file system write operations to a file system are serialised to avoid multiple disk block allocation and to ensure that the correct ordering of writes is adhered to (by applications, etc). In other words, serialising write operations ensures that the integrity of the file system is not compromised.
The most common way to implement serialised operation is to employ a locking mechanism which stipulates that processes must obtain a “lock” for a particular block of memory, in order to access that block of memory for writing. In the context of UNIX operating systems, for example, the lock is known as “inode lock” which imposes the write serialisation at a file level.
Inode lock operates on the basis that each file (which may be spread across a number of disk blocks) has a data structure associated with it, called an inode. The inode contains all of the information necessary to allow a process to access the file (e.g. for read/write) including, pointers to the disk blocks that store the file's contents, access mode permissions, file type, user and group ownership etc. In order for a process to change the contents of an inode, an inode lock must be acquired, thereby preventing other processes from accessing the inode while it is in a potentially inconsistent state. The inode lock is released only after the process has finished altering the inode. For a write operation, for example, inode lock is released only after the data has been copied from the various disk blocks (i.e. source buffers) to the file system buffer, and the associated inode data updated.
When implementing inode lock for large files the time in which inode lock is held by the process may be quite long.